import type { LocaleObject } from '@nuxtjs/i18n'

const locales: any[] = [
  {
    code: 'zh-CN',
    file: 'zh-CN.json',
    name: '简体中文',
  },
  {
    code: 'en-US',
    file: 'en-US.json',
    name: 'English',
  },
  {
    code: 'mm',
    file: 'mm.json',
    name: '缅甸语',
  },
]

function buildLocales() {
  const useLocales = Object.values(locales).reduce((acc, data) => {
    acc.push(data)

    return acc
  }, <LocaleObject[]>[])

  return useLocales.sort((a: { code: string }, b: { code: any }) => a.code.localeCompare(b.code))
}

export const currentLocales = buildLocales()
